Add a margin button to ask the assistant about a paragraph#4328
Open
zenoachtig wants to merge 6 commits into
Open
Add a margin button to ask the assistant about a paragraph#4328zenoachtig wants to merge 6 commits into
zenoachtig wants to merge 6 commits into
Conversation
🦋 Changeset detectedLatest commit: 8d6612b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Make the "ask the assistant about a selection" feature more discoverable by adding a hover-revealed icon button in the document margin for every paragraph. - AskAIParagraphButton: an absolutely-positioned, pointer-fine-only button that stages the paragraph's text as a chat reference and opens/focuses the assistant. Per-block position nudges live in the component via `in-[…]` ancestor variants. - Paragraph: wrap each paragraph in a `group/ask-ai` container and render the button when the site is in Assistant mode (on screen, non-empty paragraphs). - i18n: generalize `ai_chat_ask_about_page` -> `ai_chat_ask_about` with a parameterized target and add `this_page`/`this_text` keys across all locales; update PageActions to pass the target. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Show the button at full opacity when revealed instead of dimming it to 50%. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The per-block nudge comment referenced a removed `blockContextOffset` constant; describe the inline `in-[…]` approach instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0ffe0ee to
dfa8183
Compare
Clicking the per-paragraph Ask button now seeds the chat input with an editable
draft ("Tell me more about this") instead of an empty field — staged, focused,
cursor at the end, and not sent, so the reader can tweak or send it.
- useAIChat: add a `draft` state field and a `setDraft` controller method.
- AIChatInput: consume the draft into the (now controlled) input, focus with the
cursor at the end, then clear the pending draft so it applies once.
- AskAIParagraphButton: stage the draft on click.
- i18n: add `ai_chat_paragraph_draft` across all locales.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the awkward "Ask ${1} about this text" with a dedicated whole-phrase key
(ai_chat_ask_about_this) so each locale reads naturally — e.g. German
"${1} dazu befragen" rather than a stitched "über dies" fragment — while still
using the (variable) assistant name. Drops the now-unused this_text key.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
spastorelli
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
in-[…]ancestor variants, localized toAskAIParagraphButton) keep it clear of markers/rails/borders; it's hidden inside tables and on touch / hover-less devices.ai_chat_ask_about_pagelabel into a reusableai_chat_ask_about("Ask ${1} about ${2}") with newthis_page/this_textkeys across all locales, so the page action and the paragraph button share one parameterized string.Demo
Margin button revealed on hover (top-level paragraph):
On nested content (list items):
Clicking stages the paragraph as a reference in the assistant:
— Authored by Claude